﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ReflectAndMetadata
{
    public class InstantingTypes
    {

        //public InstantingTypes(string a, StringBuilder b)
        //{
        //    Console.WriteLine("参数1" + a+ "参数2" + b);
        //}
        public void TestActivator()
        {
            int i = (int)Activator.CreateInstance(typeof(int));
            i = 100;
            Console.WriteLine(i);
        }

        public void TestActivatorWithParam()
        {
            DateTime dt = (DateTime)Activator.CreateInstance(typeof(DateTime),
                                                   2000, 1, 1);
            Console.WriteLine(dt.Date.ToShortDateString());
        }
    }
}
